﻿using System.Linq;
using eCommerce.Core.Data;
using eCommerce.Core.Domain.Categorys;

namespace eCommerce.Services.Categorys
{
    public class CategoryService:ICategoryService
    {

        private IRepository<Category> _categoryRep;

        public CategoryService(IRepository<Category> categoryRep)
        {
            _categoryRep = categoryRep;
        }

        public Category GetDefaultCategory()
        {
            return _categoryRep.Table.FirstOrDefault(c => c.Name == "default");
        }


    }

    public interface ICategoryService
    {
        Category GetDefaultCategory();
    }
}